package co.edu.udem.service.notification;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import co.edu.udem.domain.Notification;
import co.edu.udem.service.GenericDTO;

public class NotificationDTO extends GenericDTO {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7185886823614035824L;

	private Integer uuid;

	private String subjectCode;

	private String notificationType;

	private String notificationTypeDescription;

	private Date date;

	private String title;

	private String shortDescription;

	private String longDescription;

	@Override
	public void writeValuesToStringBuilder(StringBuilder stringBuilder) {
		stringBuilder.append(this.getUuid() == null ? " NULL, "
				: this.getUuid() + ", ");
		stringBuilder.append(this.getSubjectCode() == null ? " NULL, "
				: appendValueFormat(this.getSubjectCode(), true));
		stringBuilder.append(this.getNotificationType() == null ? " NULL, "
				: appendValueFormat(this.getNotificationType(), true));
		stringBuilder.append(this.getNotificationTypeDescription() == null ? " NULL, "
				: appendValueFormat(this.getNotificationTypeDescription(), true));
		stringBuilder.append(this.getDate().toString() == null ? " NULL, "
				: appendValueFormat(this.getDate().toString(), true));
		stringBuilder.append(this.getTitle() == null ? " NULL,"
				: appendValueFormat(this.getTitle(), true));
		stringBuilder.append(this.getShortDescription() == null ? " NULL,"
				: appendValueFormat(this.getShortDescription(), true));
		stringBuilder.append(this.getLongDescription() == null ? " NULL,"
				: appendValueFormat(this.getLongDescription(), false));

	}

	public static List<GenericDTO> populateDTOList(
			List<Notification> notificationList) {
		List<GenericDTO> notificationDTOList = new ArrayList<GenericDTO>();
		NotificationDTO notificationDTO;
		if (notificationList != null && !notificationList.isEmpty()) {
			for (Notification notification : notificationList) {
				notificationDTO = new NotificationDTO();
				notificationDTO.setDate(notification.getDate());
				notificationDTO.setLongDescription(notification
						.getLongDescription());
				notificationDTO.setNotificationType(notification
						.getNotificationType());
				notificationDTO.setNotificationTypeDescription(notification
						.getNotificationTypeDescription());
				notificationDTO.setShortDescription(notification
						.getShortDescription());
				notificationDTO.setSubjectCode(notification.getSubjectCode());
				notificationDTO.setTitle(notification.getTitle());
				notificationDTO.setUuid(notification.getUuid());
				notificationDTOList.add(notificationDTO);
			}
		}
		return notificationDTOList;
	}
	
	public Integer getUuid() {
		return uuid;
	}

	public void setUuid(Integer uuid) {
		this.uuid = uuid;
	}

	public String getSubjectCode() {
		return subjectCode;
	}

	public void setSubjectCode(String subjectCode) {
		this.subjectCode = subjectCode;
	}

	public String getNotificationType() {
		return notificationType;
	}

	public void setNotificationType(String notificationType) {
		this.notificationType = notificationType;
	}

	public String getNotificationTypeDescription() {
		return notificationTypeDescription;
	}

	public void setNotificationTypeDescription(
			String notificationTypeDescription) {
		this.notificationTypeDescription = notificationTypeDescription;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getShortDescription() {
		return shortDescription;
	}

	public void setShortDescription(String shortDescription) {
		this.shortDescription = shortDescription;
	}

	public String getLongDescription() {
		return longDescription;
	}

	public void setLongDescription(String longDescription) {
		this.longDescription = longDescription;
	}

}
